package com.app.micaihu.view.main.game.adapter

import com.app.micaihu.R
import com.app.micaihu.bean.game.GameContent
import com.app.micaihu.bean.game.GameDownloadEntity
import com.app.micaihu.custom.components.downandupload.LoadingView
import com.app.micaihu.custom.view.CustomImageView
import com.app.utils.util.image.LoadImageUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.facebook.drawee.generic.RoundingParams

/**
 * 游戏 适配器
 */
class GameClassListAdapter : BaseQuickAdapter<GameContent, BaseViewHolder>(R.layout.item_game_class) {

    override fun convert(holder: BaseViewHolder, item: GameContent) {
        holder.apply {
            val downloadView = getView<LoadingView>(R.id.game_download)
            downloadView.tag = item
            val logo = getView<CustomImageView>(R.id.game_logo)
            LoadImageUtils.getInstance().loadImage(logo, item.appIcon)
            logo.hierarchy.roundingParams = RoundingParams().setCornersRadius(28.0f)

            setText(R.id.game_title, item.articleTitle)
            setText(R.id.game_desc, item.slogan)
            setText(R.id.game_size, item.appSize)
        }
    }

}